import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { parkTenantForm, TenantQuery, TenantVO } from '@/api/zichanguanli/parktenant/types';
import { TenantForm } from '@/api/system/tenant/types';

/**
 * 查询园区租户列表
 * @param query
 * @returns {*}
 */

export const listTenant = (query?: TenantQuery): AxiosPromise<TenantVO[]> => {
  return request({
    url: '/zichanguanli/parktenant/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询园区租户详细
 * @param id
 */
export const getTenant = (id: string | number): AxiosPromise<TenantVO> => {
  return request({
    url: 'zichanguanli/parktenant/' + id,
    method: 'get'
  });
};

/**
 * 新增园区租户
 * @param data
 */
export const addTenant = (data: parkTenantForm) => {
  return request({
    url: 'zichanguanli/parktenant',
    method: 'post',
    data: data
  });
};

/**
 * 修改园区租户
 * @param data
 */
export const updateTenant = (data: parkTenantForm) => {
  return request({
    url: 'zichanguanli/parktenant',
    method: 'put',
    data: data
  });
};

/**
 * 删除园区租户
 * @param id
 */
export const delTenant = (id: string | number | Array<string | number>) => {
  return request({
    url: 'zichanguanli/parktenant' + id,
    method: 'delete'
  });
};
